package com.zgc.demo.ftzf.config;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.DispatcherHandler;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.ViewResolverRegistry;
import org.springframework.web.reactive.config.WebFluxConfigurer;
import org.springframework.web.reactive.result.view.ViewResolutionResultHandler;
import org.springframework.web.reactive.result.view.ViewResolver;
import org.springframework.web.server.WebHandler;

import java.util.List;

@Configuration
@ComponentScan
@EnableWebFlux
public class WebFluxConfig implements WebFluxConfigurer {
//    @Bean
//    public WebHandler webHandler(ApplicationContext applicationContext) {
//        DispatcherHandler dispatcherHandler = new DispatcherHandler(applicationContext);
//        return dispatcherHandler;
//    }
//
//    @Bean
//    public ViewResolutionResultHandler viewResolutionResultHandler() {
//        ViewResolverRegistry registry = getViewResolverRegistry();
//        List<ViewResolver> resolvers = registry.getViewResolvers();
//        ViewResolutionResultHandler handler = new ViewResolutionResultHandler(
//                resolvers, webFluxContentTypeResolver(), webFluxAdapterRegistry());
//        handler.setDefaultViews(registry.getDefaultViews());
//        handler.setOrder(registry.getOrder());
//        return handler;
//    }
}
